using Controls;
using UI;
using UnityEngine;

namespace Globals.States
{
    public class GlobalState : MonoBehaviour, IState
    {
        [SerializeField] private PlayerController playerController;
        [SerializeField] private GameplayUi gameplayUi;
        
        
        public void Enter()
        {
            playerController.PausePerformed += PlayerController_PausePerformed;
        }

        public void OnUpdate()
        {
        }

        public void Exit()
        {
            playerController.PausePerformed -= PlayerController_PausePerformed;
        }
        
        private void PlayerController_PausePerformed()
        {
            if (GameState.Instance.CurrentState is GameStartedState)
            {
                GameState.Instance.SwitchState(typeof(PauseState));
            }
        }
    }
}
